#include "enrollwindow.h"
#include "ui_enrollwindow.h"
#include <QMessageBox>
enrollwindow *enrollwindow::myenrollwindow=nullptr;
QString verifynum;
enrollwindow::enrollwindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::enrollwindow)
{ code="";
    ui->setupUi(this);

}

enrollwindow::~enrollwindow()
{
    delete ui;
}


void enrollwindow::on_enroll_clicked()
{
    if(ui->password->text()!=ui->passwordconfirm->text()){
        QMessageBox::warning(this, tr("Waring"),
                                      tr("两次密码输入不同！"),
                                      QMessageBox::Yes);
        ui->password->clear();
        ui->passwordconfirm->clear();}
//    else if(ui->confirmnum->text()!=code){


//        QMessageBox::warning(this, tr("Waring"),
//                                      tr("验证码错误！"),
//                                      QMessageBox::Yes);
//        ui->confirmnum->clear();

//    }
    else{

//   QString id=mysocket->AddUser(ui->phone->text(),ui->name->text(),ui->password->text());
//emit(sendUseInfo(ui->phone->text(),ui->name->text(),ui->password->text()));

        emit(sendUseInfo(ui->phone->text(),ui->name->text(),ui->password->text(),ui->confirmnum->text()));

    }

}

void enrollwindow::on_send_clicked()
{
 emit sendphone(ui->phone->text());

}
void enrollwindow::getVerificationCode(QString msg){

  code=msg;

}
void enrollwindow::SuccessAndgetMyId(QString id){

//QMessageBox::information(this, QString::fromLocal8Bit("您好,恭喜您注册成功"),QString::fromLocal8Bit(id));
qDebug()<<"id: "<<id;
QMessageBox::information(this, QString("您好,恭喜您注册成功,请用id在登录界面登录"),QString("这是您的id:"+id));




}
